/* Flash OS Routines (Automagically Generated)
 * Copyright (c) 2009-2015 ARM Limited
 */
#include "flash_blob.h"

static const uint32_t flash_code[] = {
    0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
    0x2000B50C, 0x90009001, 0x49AC2011, 0x48AC6008, 0x49AC6840, 0x49AA4008, 0x46086048, 0xF4406840,
    0x60481020, 0x68004608, 0x7080F040, 0xBF006008, 0x680048A3, 0x7000F000, 0xD0F92800, 0x684048A0,
    0x0003F020, 0x6048499E, 0x68404608, 0x0002F040, 0xBF006048, 0x6840489A, 0x000CF000, 0xD1F92808,
    0xB570BD0C, 0x460D4604, 0x48954616, 0xF0206840, 0x499300F0, 0x46086048, 0xF0406840, 0x60480080,
    0x68404608, 0x00F0F020, 0x488F6048, 0xF4406840, 0x498D5080, 0xF7FF6048, 0x488CFFB3, 0x60484987,
    0x6048488B, 0x69C04608, 0x0004F000, 0xF245B940, 0x49885055, 0x20066008, 0xF6406048, 0x608870FF,
    0xBD702000, 0x48804601, 0xF4206840, 0x4A7E5080, 0x487A6050, 0xF0406900, 0x4A780080, 0x20006110,
    0xB5104770, 0x6F404875, 0x0001F000, 0xD0412800, 0xE03C2100, 0x6F404871, 0x000CF000, 0xD10B2808,
    0x6F80486E, 0x030AF3C0, 0x6F80486C, 0x42990D82, 0x4291D302, 0xE029D800, 0x69004868, 0x0002F040,
    0x61204C66, 0xF1000288, 0x61606000, 0x69004620, 0x0040F040, 0xE0036120, 0x20AAF64A, 0x60204C65,
    0x68C0485E, 0x0001F000, 0xD1F52800, 0x6900485B, 0x0002F020, 0x61204C59, 0x68C04620, 0x0014F000,
    0x2014B118, 0x200160E0, 0xBF00BD10, 0x29101C49, 0xE01BD3C0, 0x69004851, 0x0004F040, 0x61204C4F,
    0x69004620, 0x0040F040, 0xE0036120, 0x20AAF64A, 0x60204C50, 0x68C04849, 0x0001F000, 0xD1F52800,
    0x69004846, 0x0004F020, 0x61204C44, 0xE7DB2000, 0x4601B530, 0x5F00F1B1, 0x2000D301, 0x483FBD30,
    0xF0006F40, 0x2808000C, 0x483CD10E, 0xF3C06F80, 0x483A030A, 0x0D846F80, 0x228FF3C1, 0xDB03429A,
    0xDC0142A2, 0xE7E92000, 0x69004834, 0x0002F040, 0x61284D32, 0x61414628, 0xF0406900, 0x61280040,
    0xF64AE003, 0x4D3320AA, 0x482C6028, 0xF00068C0, 0x28000001, 0x4829D1F5, 0xF0206900, 0x4D270002,
    0x46286128, 0xF00068C0, 0xB1180014, 0x60E82014, 0xE7C32001, 0xE7C12000, 0x4603B510, 0xF0201C48,
    0xF1B30101, 0xD3095F00, 0x8810E004, 0x1C9B8018, 0x1E891C92, 0xD1F82900, 0xBD102000, 0x4817E029,
    0xF0406900, 0x4C150001, 0x88106120, 0xE0038018, 0x20AAF64A, 0x60204C17, 0x68C04810, 0x0001F000,
    0xD1F52800, 0x6900480D, 0x0001F020, 0x61204C0B, 0x20AAF64A, 0x60204C0F, 0x68C04808, 0x0014F000,
    0x2014B120, 0x60E04C05, 0xE7D62001, 0x1C9B1E89, 0x29001C92, 0x2000D1D3, 0x0000E7CF, 0x40022000,
    0x40021000, 0x1FC0FFFF, 0xE0042000, 0x45670123, 0xCDEF89AB, 0x40003000, 0x00000000
};

const program_target_t flash_algo = {
    0x20000083,  // Init
    0x200000E5,  // UnInit
    0x20000103,  // EraseChip
    0x200001D1,  // EraseSector
    0x20000259,  // ProgramPage

    // BKPT : start of blob + 1
    // RSB  : address to access global/static data
    // RSP  : stack pointer
    {
        0x20000001,
        0x20000C00,
        0x20001000
    },

    0x20000400,  // mem buffer location
    0x20000000,  // location to write prog_blob in target RAM
    sizeof(flash_code),  // prog_blob size
    flash_code,  // address of prog_blob
    0x00000400,  // ram_to_flash_bytes_to_be_written
};
